<template>
  <div>
    {{username}}
  </div>
</template>

<script>
import {getUserById} from "@/api/user";
export default {
  name: "UserNameById",
  props:['id'],
  data() {
    return {
      username:''
    }
  },
  methods:{
    async user1() {
      const t = await getUserById(this.id);
      if (t.data.code === 200) {
        this.username = t.data.data[0].username
      }
    }
  },
  mounted() {
    this.user1()
  }
}
</script>

<style scoped>

</style>